// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: >
    Generator functions declared as methods honor their declared formal
    parameters.
es6id: 14.4.13
features: [generators]
---*/

function Test() {
    var value1 = {};
    var value2 = {};
    var value3 = {};
    var arg1, arg2, arg3;
    var obj = {
      *method(a, b, c) {
        arg1 = a;
        arg2 = b;
        arg3 = c;
      }
    };

    obj.method(value1, value2, value3).next();

    assert.sameValue(arg1, value1);
    assert.sameValue(arg2, value2);
    assert.sameValue(arg3, value3);
}

// preheat
const NUMBER_OF_PREHEAT = 1;
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}

ArkTools.jitCompileAsync(Test);
assert.sameValue(ArkTools.waitJitCompileFinish(Test), true, '[JIT] JIT disabled.');

// test
const NUMBER_OF_TEST = 1; // or 2
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}
